//
//  ZFUtils.swift
//  map
//
//  Created by fyzq on 2024/2/4.
//

import UIKit

class ZFUtils: NSObject {

    //    (degrees: Int, minutes: Int, seconds: Double)
       static func convertToDegreesMinutesSeconds(from degrees: Double) -> String{
            
           let absoluteValue = abs(degrees) // 获取绝对值
            let wholePart = floor(absoluteValue) // 获取整数部分
            var decimalPart = absoluteValue - wholePart // 获取小数部分
            
            let minutes = floor(decimalPart * 60) // 计算分钟部分
            decimalPart -= minutes / 60
            let seconds = decimalPart * 3600 // 计算秒部分
            
            return "\(Int(wholePart))°\(Int(minutes))'\(String(format: "%.2f", seconds))"
    //        return  (Int(wholePart), Int(minutes), seconds)
        }
}
